package cn.com.sparkle.paxos.net.factory.raptor;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Properties;

public class Conf {
	private int iothreadnum;
	private int recieveCell;
	private int recieveBuffSize;
	private int sendCell;
	private int sendBuffSize;
	private int workthreadMinNum;
	private int workthreadMaxNum;
	
	public Conf(String path) throws FileNotFoundException, IOException{
		Properties prop = new Properties();
		prop.load(new InputStreamReader(new FileInputStream(path)));
		iothreadnum = Integer.parseInt(prop.getProperty("io_thread_num"));
		recieveCell = Integer.parseInt(prop.getProperty("recieve_cell_size"));
		recieveBuffSize = Integer.parseInt(prop.getProperty("recieve_mem_size"));
		sendCell = Integer.parseInt(prop.getProperty("send_mem_cell_size"));
		sendBuffSize = Integer.parseInt(prop.getProperty("send_mem_size"));
		workthreadMinNum = Integer.parseInt(prop.getProperty("worker_thread_min_num"));
		workthreadMaxNum = Integer.parseInt(prop.getProperty("worker_thread_max_num"));
	}

	public int getIothreadnum() {
		return iothreadnum;
	}

	public int getRecieveCell() {
		return recieveCell;
	}

	public int getRecieveBuffSize() {
		return recieveBuffSize;
	}

	public int getSendCell() {
		return sendCell;
	}

	public int getSendBuffSize() {
		return sendBuffSize;
	}

	public int getWorkthreadMinNum() {
		return workthreadMinNum;
	}

	public int getWorkthreadMaxNum() {
		return workthreadMaxNum;
	}

	
}
